local chongwu = fk.CreateSkill {
  name = "lvshi__chongwu&",
  mode_skill = true,
}

Fk:loadTranslationTable{
  ["lvshi__chongwu&"] = "崇武",
  [":lvshi__chongwu&"] = "出牌阶段开始时，你可摸一张牌，与一名其他角色拼点；若你赢，你于此回合获得效果：回合技，当你使用牌对非先驱角色造成伤害时，你可令此伤害+1。（X为主忠方存活角色数）",
  ["#lvshi__chongwu-choose"] = "请选择一名角色拼点",
  ["@@ev_shenwu-turn"] = "崇武",
}

chongwu:addEffect(fk.EventPhaseStart, {
  anim_type = "drawcard",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(chongwu.name) and player.phase == Player.Play
  end,
  on_cost = function (self, event, target, player, data)
    return player.room:askToSkillInvoke(player, {skill_name = chongwu.name})
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    player:drawCards(1, chongwu.name)
    local targets = table.filter(room:getOtherPlayers(player), function (p)
      return player:canPindian(p)
    end)
    if #targets == 0 then return end
    local to = room:askToChoosePlayers(player, {
      targets = targets,
      min_num = 1,
      max_num = 1,
      skill_name = chongwu.name,
      prompt = "#lvshi__chongwu-choose",
      cancelable = false,
    })
    if #to == 0 then return end
    local pindian = player:pindian({to[1]}, chongwu.name)
    if pindian.results[to[1]].winner == player then
      room:addPlayerMark(player, "@@ev_shenwu-turn")
    end
  end,
})

chongwu:addEffect(fk.DamageCaused, {
  anim_type = "offensive",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(chongwu.name) and data.card and player:getMark("@@ev_shenwu-turn") > 0
    and player.room:getTag("prophet") ~= data.to.id
  end,
  on_cost = function (self, event, target, player, data)
    return player.room:askToSkillInvoke(player, {skill_name = chongwu.name})
  end,
  on_use = function(self, event, target, player, data)
    player.room:setPlayerMark(player, "@@ev_shenwu-turn", 0)
    data:changeDamage(1)
  end,
})


return chongwu
